package com.lyn.solitude_plugin_api.entity;

import android.app.Application;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;

/**
 * @author longyn 2024/5/10
 * @version 1.0.0
 */
public class Plugin {

    public final String id;
    public final String name;
    public final String path;
    public final int version;
    public final Drawable logoDrawable;
    public final String soPath;
    public final Mate mate;

    public Plugin(Builder builder) {
        this.id = builder.id;
        this.name = builder.name;
        this.path = builder.path;
        this.version = builder.version;
        this.logoDrawable = builder.logoDrawable;
        this.soPath = builder.soPath;
        this.mate = builder.mate;
    }

    public static class Mate {
        public String id;
        public String activityClassName;
        public ClassLoader classLoader;
        public Resources resources;

        public void setId(String id) {
            this.id = id;
        }

        public void setActivityClassName(String activityClassName) {
            this.activityClassName = activityClassName;
        }

        public void setClassLoader(ClassLoader classLoader) {
            this.classLoader = classLoader;
        }

        public void setResources(Resources resources) {
            this.resources = resources;
        }
    }

    public static class Simple {
        private String id;
        private String name;
        private int version;
        private String path;
        private String soPath;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getVersion() {
            return version;
        }

        public void setVersion(int version) {
            this.version = version;
        }

        public String getPath() {
            return path;
        }

        public void setPath(String path) {
            this.path = path;
        }

        public String getSoPath() {
            return soPath;
        }

        public void setSoPath(String soPath) {
            this.soPath = soPath;
        }
    }

    public static class Builder {

        public final Application application;
        public final String path;
        public String id;
        public String name;
        public int version;
        public Drawable logoDrawable;
        public String soPath;
        public Mate mate;

        public Builder(Application application, String path) {
            this.path = path;
            this.application = application;
        }

        public void setId(String id) {
            this.id = id;
        }

        public void setName(String name) {
            this.name = name;
        }


        public void setVersion(int version) {
            this.version = version;
        }

        public void setLogoDrawable(Drawable logoDrawable) {
            this.logoDrawable = logoDrawable;
        }


        public void setSoPath(String soPath) {
            this.soPath = soPath;
        }

        public void setMate(Mate mate) {
            this.mate = mate;
        }

        public Plugin build() {
            return new Plugin(this);
        }
    }

}
